package model

import (
	"github.com/lib/pq"
	"gorm.io/gorm"
)

// 意见返回问题表
type Question struct {
	gorm.Model
	Project     string         `gorm:"type:varchar(64);comment:项目名" json:"project"`
	CategoryId  int            `gorm:"type:int8;comment:类别id" json:"category_id"`
	Platform    string         `gorm:"type:varchar(512);comment:操作平台" json:"platform"`
	Description string         `gorm:"not null;comment:问题描述" json:"description"`
	Version     string         `gorm:"type:varchar(64);comment:版本号" json:"version"`
	Product     string         `gorm:"type:varchar(512);comment:型号" json:"product"`
	Images      pq.StringArray `gorm:"type:text[];comment:图片" json:"images"`
	ActiveDays  int            `gorm:"type:uint64;comment:活跃天数" json:"active_days"`
	Email       string         `gorm:"type:varchar(512);comment:邮箱" json:"email"`
	Status      int            `gorm:"type:smallint;default:0;comment:处理状态" json:"status"`
}

func (Question) TableName() string {
	return "question"
}

// QuestionCategory 意见反馈问题类型
type QuestionCategory struct {
	gorm.Model
	Project      string `gorm:"type:varchar(64);comment:项目名"`
	TranslateKey string `gorm:"comment:翻译表key"`
	Sort         int8   `gorm:"comment:排序"`
	Default      int8   `gorm:"comment:是否默认选中"`
}

func (QuestionCategory) TableName() string {
	return "question_category"
}
